public class MathOperations {
    public static void main(String[] args) {
        double num1 = 3;
        double num2 = 2;

        // 加法
        System.out.println(add(num1, num2)); 

        // 减法
        System.out.println(subtract(num1, num2));

        // 乘法
        System.out.println(multiply(num1, num2));

        // 除法
        if (num2 != 0){
            System.out.println(divide(num1, num2));
        } else {
            System.out.println("Divisor cannot be zero.");
        }
        
    }

    private static double add(double a, double b){
        return a + b;
    }

    private static double subtract(double a, double b){
        return a - b;
    }

    private static double multiply(double a, double b){
        return a * b;
    }

    private static double divide(double a, double b){
        return a / b;
    }
}